Public Class Form1 Inherits System.Windows.Forms.Form Const addAmount As Double = 10 #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents TxtInput As System.Windows.Forms.TextBox Friend WithEvents txtOutput As System.Windows.Forms.TextBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents BtnCalc As System.Windows.Forms.Button Private Sub InitializeComponent() Me.TxtInput = New System.Windows.Forms.TextBox Me.txtOutput = New System.Windows.Forms.TextBox Me.Label1 = New System.Windows.Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.BtnCalc = New System.Windows.Forms.Button Me.SuspendLayout() ' 'TxtInput ' Me.TxtInput.Location = New System.Drawing.Point(168, 24) Me.TxtInput.Name = "TxtInput" Me.TxtInput.Size = New System.Drawing.Size(104, 20) Me.TxtInput.TabIndex = 0 Me.TxtInput.Text = "" ' 'txtOutput ' Me.txtOutput.Location = New System.Drawing.Point(168, 72) Me.txtOutput.Name = "txtOutput" Me.txtOutput.ReadOnly = True Me.txtOutput.Size = New System.Drawing.Size(104, 20) Me.txtOutput.TabIndex = 1 Me.txtOutput.Text = "" ' 'Label1 ' Me.Label1.Location = New System.Drawing.Point(72, 24) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(80, 16) Me.Label1.TabIndex = 2 Me.Label1.Text = "Input" ' 'Label2 ' Me.Label2.Location = New System.Drawing.Point(72, 72) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(80, 16) Me.Label2.TabIndex = 3 Me.Label2.Text = "Output" ' 'BtnCalc ' Me.BtnCalc.Location = New System.Drawing.Point(160, 120) Me.BtnCalc.Name = "BtnCalc" Me.BtnCalc.Size = New System.Drawing.Size(72, 32) Me.BtnCalc.TabIndex = 4 Me.BtnCalc.Text = "Calculate" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(292, 273) Me.Controls.Add(Me.BtnCalc) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.txtOutput) Me.Controls.Add(Me.TxtInput) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) End Sub #End Region Private Sub BtnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalc.Click Dim input As Double If IsNumeric(TxtInput.Text) Then input = Convert.ToDouble(TxtInput.Text) If (input > 0) And (input <= 200) Then ' input is valid Dim output As Double output = input + addAmount txtOutput.Text = output.ToString("c") Else MsgBox("Please enter a price betweeen 0 and 200") End If Else MsgBox("You idiot, enter a number") End If End Sub End Class